//
//  CoreDataOperation.m
//  CoreDataDemo
//
//  Created by liuxiang on 2018/1/9.
//  Copyright © 2018年 liuxiang. All rights reserved.
//

#import "CoreDataOperation.h"
#import <CoreData/CoreData.h>

@interface CoreDataOperation()

@property (strong, nonatomic) NSManagedObjectContext *privatemoc;

@property (strong, nonatomic) NSManagedObjectContext *mainmoc;

@property (strong, nonatomic) NSManagedObjectModel *mom;

@end

@implementation CoreDataOperation


#pragma mark -
- (NSManagedObjectContext *) privatemoc {
    if (!_privatemoc) {
        _privatemoc = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
    }
    return _privatemoc;
}

- (NSManagedObjectContext *) mainmoc {
    if (!_mainmoc) {
        _mainmoc = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
    }
    return _mainmoc;
}

- (NSManagedObjectModel *) mom {
    if (!_mom) {
        _mom = [NSManagedObjectModel mergedModelFromBundles:nil];
    }
    return _mom;
}



@end
